/*
  Copyright (C) 2015 Luca Donaggio
  Contact: Luca Donaggio <donaggio@gmail.com>
  All rights reserved.

  You may use this file under the terms of MIT license as follows:

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

import QtQuick 2.0
import Sailfish.Silica 1.0
import "../lib/theme.js" as AppTheme

SilicaFlickable {
    id: settingsUI

    property alias typeID: paramType.currentIndex
    property alias iterations: paramIterations.value
    property alias showInfo: paramShowInfo.checked
    property alias gradientID: paramGradient.currentIndex

    contentHeight: header.height + settingsUIContainer.height

    PageHeader {
        id: header

        title: qsTr("Settings")
    }

    Column {
        id: settingsUIContainer

        anchors.top: header.bottom
        width: parent.width
        spacing: Theme.paddingSmall

        SectionHeader {
            text: qsTr("Fractal")
        }

        ComboBox {
            id: paramType

            label: qsTr("Type")
            description: qsTr("Choose the mathematical set to explore")
            menu: ContextMenu {
                MenuItem { text: AppTheme.fractalTypes[0]; }
                MenuItem { text: AppTheme.fractalTypes[1]; enabled: false; }
            }
        }

        Slider {
            id: paramIterations

            width: parent.width
            label: qsTr("Iterations limit")
            minimumValue: AppTheme.minIterations
            maximumValue: AppTheme.maxIterations
            stepSize: 10
            valueText: value
        }

        SectionHeader {
            text: qsTr("Appearance")
        }

        TextSwitch {
            id: paramShowInfo

            text: qsTr("Show navigation info")
            description: qsTr("Display current coordinates, zoom level and other (possibly) useful details")
        }

        ComboBox {
            id: paramGradient

            label: qsTr("Color map")
            description: qsTr("Gradient pattern to apply when rendering the fractal image")
            menu: ContextMenu {
                MenuItem { text: qsTr("Blue - Orange"); }
                MenuItem { text: qsTr("Red - Yellow"); }
                MenuItem { text: qsTr("Green - Purple"); }
            }
        }
    }

    VerticalScrollDecorator { flickable: settingsUI; }
}
